<template>
  <view class="home_category">
    <navigator :url="`/pages/imgCategory/index?id=${item.id}&cate=phone`" class="cate_item" v-for="item in category" :key="item.id">
      <image mode="widthFix" :src="item.cover"></image>
      <view class="cate_name">{{ item.name }}</view>
    </navigator>
  </view>
</template>

<script>
export default {
  data() {
    return {
      category: [],
    };
  },
  mounted() {
    uni.setNavigationBarTitle({
      title: "分类",
    });
    this.getList();
  },
  methods: {
    getList() {
      this.request({
        url: "http://service.picasso.adesk.com/v1/wallpaper/category",
      }).then((res) => {
        // console.log(res);
        this.category = res.data.res.category;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.home_category {
  padding: 10rpx;
  display: flex;
  flex-wrap: wrap;
  .cate_item {
    position: relative;
    border: 5rpx solid #fff;
    width: 33.33%;
    .cate_name {
      position: absolute;
      bottom: 0;
      left: 0;
      padding-left: 15rpx;
      padding-bottom: 15rpx;
      width: 100%;
      color: #fff;
      font-size: 28rpx;
      background: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.3));
    }
  }
}
</style>
